<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>超级电容启动电源</title>
    <link rel="stylesheet" href="index.css">
</head>
<body>
<div class="main">
    <div id="connect" class="connect">
        <div id="connect-btn" class="box btn blue"  onclick="connect(this)">
            <div><span class="size20-btn">连接蓝牙</span></div>
        </div>
    </div>
    <div id="container" class="container">
        <div id="power" class="box blue-purple">
            <div><span class="size40">--</span>%</div>
            <div>电量</div>
        </div>
        <div id="discharge-status" class="box gray">
            <div><span class="size40">--</span></div>
            <div>放电状态
                <span id="waiting" style="padding: 0 2px; border-radius: 4px; display: none" class="purple">等待<span id="waiting-timer"></span></span>
            </div>
        </div>
        <div id="battery-voltage" class="box green" >
            <div><span class="size40">--</span>v</div>
            <div>电瓶电压</div>
        </div>
        <div id="usb-status" class="box green" >
            <div><span class="size40">--</span>v</div>
            <div>USB电压</div>
        </div>
        <div id="capacitor-voltage" class="box green" >
            <div><span class="size40">--</span>v</div>
            <div>电容电压</div>
        </div>
        <div id="capacitance-temperature" class="box green">
            <div><span class="size40">--</span>&#8451;</div>
            <div>电容温度</div>
        </div>
        <div id="discharge-protection" class="box green">
            <div><span class="size40">--</span></div>
            <div>放电可用</div>
        </div>
        <div id="charging-speed" class="box light-green" onclick="showEditContainer('charging-speed')">
            <div><span class="size40">--</span>%</div>
            <div>充电速度</div>
        </div>
        <div id="cut-off-voltage" class="box light-green" onclick="showEditContainer('cut-off-voltage')">
            <div><span class="size40">--</span>v</div>
            <div>截止电压</div>
        </div>


        <div id="light-enable" data-value="1" class="box light-green" onclick="changeLightEnable()">
            <div><span class="size40">--</span></div>
            <div>照明可用</div>
        </div>
        <div id="light-status" class="box grey" onclick="changeLightStatus()">
            <div><span class="size40">--</span></div>
            <div>照明开关</div>
        </div>
        <div id="light-brightness" class="box light-green" onclick="showEditContainer('light-brightness')">
            <div><span class="size40">--</span>%</div>
            <div>照明亮度</div>
        </div>

        <div id="discharge-mode" class="box light-green" onclick="showEditContainer('discharge-mode')">
            <div><span class="size20">--</span></div>
            <div>放电模式</div>
        </div>
        <div id="used-mode" class="box light-green" onclick="showEditContainer('used-mode')">
            <div><span class="size20">--</span></div>
            <div>用途模式</div>
        </div>
        <div id="auto-discharge-sensitivity" class="box light-green" onclick="showEditContainer('auto-discharge-sensitivity')">
            <div><span class="size40">--</span><span>级</span></div>
            <div>自动放电灵敏度</div>
        </div>
        <div id="car-discharge-sensitivity" class="box light-green" onclick="showEditContainer('car-discharge-sensitivity')">
            <div><span class="size40">--</span><span>级</span></div>
            <div>车载放电灵敏度</div>
        </div>
        <div id="sos" onclick="changeSos()" class="box light-green" >
            <div><span class="size40">--</span></div>
            <div>SOS</div>
        </div>
        <div class="box" style="">
            <div><span class="size20"></span></div>
            <div></div>
        </div>

        <div class="box btn" style="">
            <div><span class="size20-btn"></span></div>
        </div>
        <div class="box btn" style="">
            <div><span class="size20-btn"></span></div>
        </div>
        <div id="auto-discharge-btn" class="box btn disabled" data-value="0" onclick="submitButton(this, '02-001')">
            <div><span class="size20-btn">自动放电</span></div>
        </div>
        <div id="timer-discharge-btn" class="box btn disabled" data-value="0" onclick="submitButton(this, '03-001')">
            <div><span class="size20-btn">倒计时放电</span></div>
        </div>
        <div id="manually-discharge-btn" class="box btn disabled" data-value="0" onclick="submitButton(this, '04-001')">
            <div><span class="size20-btn">手动放电</span></div>
        </div>
        <div id="off-discharge-btn" class="box btn disabled" data-value="0" onclick="submitButton(this, '05-001')" >
            <div><span class="size20-btn">关闭放电</span></div>
        </div>

        <div class="box btn" style="">
            <div><span class="size20-btn"></span></div>
        </div>
        <div class="box btn" style="">
            <div><span class="size20-btn"></span></div>
        </div>
        <div class="box btn" style="">
            <div><span class="size20-btn"></span></div>
        </div>
        <div class="box btn" style="">
            <div><span class="size20-btn"></span></div>
        </div>
        <div id="disconnect-btn" class="box btn blue"  onclick="disconnect(this)">
            <div><span class="size20-btn">断开蓝牙</span></div>
        </div>
        <div id="off-btn" class="box btn disabled" data-value="0" onclick="submitButton(this, '13-001')">
            <div><span class="size20-btn">关机</span></div>
        </div>
        <div style="color: #ffffff;">
            <div>提示：</div>
            <div>截止电压：车载稳压用途模式下电容充满的截止电压</div>
            <div>自动放电灵敏度：级数越高越容易触发救援模式点火时的自动放电</div>
            <div>车载放电灵敏度：级数越高越早触发车载稳压模式的接通放电，“点火接通”仅在检测到点火动作时接通，“等压接通”在电容充至与电瓶电压相等时无电流冲击接通</div>
            <div>关机按键：外接电源时无法关机</div>
        </div>
    </div>
    <div id="edit-container" class="edit-container">
        <div class="edit-panel">
            <div class="edit-panel-title" id="edit-panel-title">编辑照明亮度</div>
            <div class="edit-panel-content">
                <label for="edit-panel-content-input"></label><input type="number" value="" id="edit-panel-content-input">
                <label for="edit-panel-content-select"></label><select id="edit-panel-content-select"></select>
            </div>
            <div class="edit-panel-bottom">
                <div class="box btn blue-border" onclick="showEditContainer()" >
                    <div><span class="size20-btn" >取消</span></div>
                </div>
                <div  class="box btn blue" onclick="submitData()">
                    <div><span class="size20-btn" >发送</span></div>
                </div>
            </div>
        </div>
    </div>
</div>

<label for="test-data"></label><input id="test-data" value="12.04-12.21-0.10-17.81-28-15.00-100-0-0-0-2-0-6-2-80-0-0-1-0" style="width:100%; display: none;"/>
<script src="./bluetooth.js"></script>
<script src="./opt.js"></script>
<script>
    if (/Mobi|Android|iPhone/i.test(navigator.userAgent)) {
        window.location.replace('./mobile.html');
    } else {
        isTest = false;
        init();
    }

</script>
</body>
</html>